package thread;


import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class Demo28 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(2);
        queue.put("1");
        System.out.println("put成功！");
        queue.put("2");
        System.out.println("put成功！");
        queue.take();
        System.out.println("take成功！");
        queue.take();
        System.out.println("take成功！");
        queue.take();
        System.out.println("take成功！");

    }
}
